package org.watchrecords.inject;

import org.apache.wicket.protocol.http.WebApplication;
import org.watchrecords.WatchRecordsApplication;
import org.watchrecords.WatchRecordsSession;
import org.watchrecords.annotations.SiteTitle;
import org.watchrecords.annotations.UniqueNamedValidator;
import org.watchrecords.elements.BasicForm;

import com.google.inject.Binder;
import com.google.inject.Module;
import com.wideplay.warp.persist.PersistenceService;
import com.wideplay.warp.persist.UnitOfWork;
import com.wideplay.warp.persist.jpa.JpaUnit;

public class ConstantModule implements Module {
    public void configure(Binder binder) {
        binder.bindConstant().annotatedWith(JpaUnit.class).to("openjpa");
        binder.install(PersistenceService.usingJpa().across(UnitOfWork.REQUEST).buildModule());
        binder.bind(WebApplication.class).to(WatchRecordsApplication.class);
        binder.requestStaticInjection(WatchRecordsSession.class);
        binder.requestStaticInjection(UniqueNamedValidator.class);
        binder.requestStaticInjection(BasicForm.class);
        binder.bindConstant().annotatedWith(SiteTitle.class).to("Stormwind City Watch Records");
    }
}
